Skip to content

catch PropelAuthRateLimit error on all requests#66

Merged
andrew-propelauth merged 2 commits intomainfrom
feat/1031
Feb 21, 2025
Merged

catch PropelAuthRateLimit error on all requests#66
andrew-propelauth merged 2 commits intomainfrom
feat/1031

Conversation

@mrmauer
Copy link
Contributor

@mrmauer mrmauer commented Feb 11, 2025

After PR

Bumps minor version to 0.22.0

Currently, if a customer's BE hits a PropelAuth rate limit, this library converts the response into

Result::Err(SomeRequestSpecificError::UnexpectedException)

After this change, these responses will instead be converted to

Result::Err(SomeRequestSpecificError::PropelAuthRateLimit)

Note

All validate*_api_key methods perform additional parsing on the error body in the case of a 429 to distinguish between rate limits set by customers to be enforced on end-users – ie the recently added

ApiKeyValidationErrorResponse::EndUserApiKeyRateLimited{ ... }

and rate limits set and imposed by PropelAuth – ie the new

SomeRequestSpecificError::PropelAuthRateLimit

Test

  1. Setup a local dev environment with a rate limit on the hostname of 5 request / 10 seconds and a rate limit of 10 requests / 1 minute on personal api keys.
  2. Spammed an example app with w/ a personal api key
  3. validated the example app's responses could differentiate between when the PropelAuth rate limit was hit and and when the personal-api-key rate limit was hit. The detailed error message data was still successfully parsed and returned in the case of an end-user rate limit being hit.

@mrmauer mrmauer marked this pull request as ready for review February 12, 2025 17:26
Copy link
Contributor

@andrew-propelauth andrew-propelauth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@andrew-propelauth andrew-propelauth merged commit 8c53f8c into main Feb 21, 2025
2 checks passed
@andrew-propelauth andrew-propelauth deleted the feat/1031 branch February 21, 2025 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants